/**
 * Copyright (C) 2013 DaiKit.com - daikit4gxt-sample module (admin@daikit.com)
 *
 *         Project home : http://code.daikit.com/commons
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.daikit.daikit4gxtsample.shared.bean;

import java.util.ArrayList;
import java.util.List;

import com.daikit.commons.shared.bean.AbstractDkModifiableAndCleanableBeanWithId;


/**
 * Supplier detail data
 * 
 * @author tcaselli
 * @version $Revision$ Last modifier: $Author$ Last commit: $Date$
 */
public class SupplierDetailData extends AbstractDkModifiableAndCleanableBeanWithId
{

	private static final long serialVersionUID = 497642800025142737L;

	private String name;
	private List<StockDetailData> stockDetails = new ArrayList<StockDetailData>();
	private SupplierData supplier;
	private WarehouseData warehouse;
	private Double progress = Double.valueOf(0d);
	private SupplierAvailabilityData availability;

	@Override
	protected StringBuilder getToStringBuilder()
	{
		final StringBuilder stringBuilder = super.getToStringBuilder();
		stringBuilder.append(",name=").append(getName());
		stringBuilder.append(",stockDetails=").append(getStockDetails());
		stringBuilder.append(",supplier=").append(getSupplier());
		stringBuilder.append(",warehouse=").append(getWarehouse());
		stringBuilder.append(",progress=").append(getProgress());
		stringBuilder.append(",availability=").append(getAvailability());
		return stringBuilder;
	}

	@Override
	protected void cleanDirtyOnChildren()
	{
		for (final StockDetailData stockDetail : stockDetails)
		{
			stockDetail.cleanDirty();
		}
	}

	/**
	 * @return the availability
	 */
	public SupplierAvailabilityData getAvailability()
	{
		return availability;
	}

	/**
	 * @param availability
	 *           the availability to set
	 */
	public void setAvailability(final SupplierAvailabilityData availability)
	{
		this.availability = availability;
	}

	/**
	 * @return the name
	 */
	public String getName()
	{
		return name;
	}

	/**
	 * @param name
	 *           the name to set
	 */
	public void setName(final String name)
	{
		this.name = name;
	}

	/**
	 * @return the stockDetails
	 */
	public List<StockDetailData> getStockDetails()
	{
		return stockDetails;
	}

	/**
	 * @param stockDetails
	 *           the stockDetails to set
	 */
	public void setStockDetails(final List<StockDetailData> stockDetails)
	{
		this.stockDetails = stockDetails;
	}

	/**
	 * @return the supplier
	 */
	public SupplierData getSupplier()
	{
		return supplier;
	}

	/**
	 * @param supplier
	 *           the supplier to set
	 */
	public void setSupplier(final SupplierData supplier)
	{
		this.supplier = supplier;
	}

	/**
	 * @return the warehouse
	 */
	public WarehouseData getWarehouse()
	{
		return warehouse;
	}

	/**
	 * @param warehouse
	 *           the warehouse to set
	 */
	public void setWarehouse(final WarehouseData warehouse)
	{
		this.warehouse = warehouse;
	}

	/**
	 * @return the progress
	 */
	public Double getProgress()
	{
		return progress;
	}

	/**
	 * @param progress
	 *           the progress to set
	 */
	public void setProgress(final Double progress)
	{
		this.progress = progress;
	}

}
